﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using UIWindows.Domains;
using XingLucifer.IBase.Enums;

namespace UIWindows.Models.ParameterModels
{
    public class WeighingConfigModel : ViewModelBase
    {
        //public TaskTypes _scaleType;
        /// <summary>
        /// 称重类型：前称 OR 后称
        /// </summary>
        private TaskTypes scaleType;
        public TaskTypes ScaleType
        {
            get { return scaleType; }
            set
            {
                if (scaleType != TaskTypes.前称重&& scaleType != TaskTypes.后称重)
                {
                    scaleType = value;
                }
                else if (scaleType != value)
                {
                    if (MessageBox.Show($"确定要从当前{scaleType}切换成=>{value},当前电池位置:{CurrentLocation}", "询问", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                    {
                        CurrentLocation = 0;
                        IsInitialized = true;
                        scaleType = value;
                    }
                  
                }
            }
        }
        //= TaskTypes.前称重;

        /// <summary>
        /// 是否初始化
        /// </summary>
        public bool IsInitialized { get; set; }


        private int currentLocation =0;
        /// <summary>
        /// 当前位置
        /// </summary>
        public int CurrentLocation
        {
            get { return currentLocation; }
            set { SetProperty(ref currentLocation, value); }
        }
    }
}
